import service from '@/utils/request.js'
// 登录
export const login = (data) => {
  return service({
    url: '/user/login',
    method: 'post',
    data,
    setting: {
      isToken: false  // 明确指定登录接口不需要token
    }
  })
}

export const register = (data) => {
  return service({
    url: '/user/register',
    method: 'post',
    data,
    setting: {
      isToken: false  // 明确指定注册接口不需要token
    }
  })
}

// 更新用户信息
export const update = (params = {}) => {
  return service({
    url: '/user/update',
    method: 'put',
    data: params
  })
};

// 退出登录
export const logout = () => {
  return service({
    url: '/user/logout',
    method: 'post'
  })
};

// 获取用户信息
export const getUserInfo = () => {
  return service({
    url: '/user/chat/info',
    method: 'get'
  })
};

// 获取验证码
export const captcha = () => {
    return service({
        url: "/captcha",
        method: "GET",
        setting: {
            isToken: false  // 明确指定注册接口不需要token
        }
    });
};

// 验证码验证
export const captchaVerify = (params = {}) => {
    return service({
        url: "/captcha/verify",
        method: "POST",
        data: params,
        setting: {
            isToken: false  // 明确指定注册接口不需要token
        }
    });
};
